#!/usr/bin/python
# Script for automatically run performance tests
# author: sana
# contributor: tct

import subprocess

# list of data structures
teste = ["algorithms",
         "avl_tree",
         "b_tree",
         "binary_search_tree",
         "binary_tree",
         "doubly_linked_list",
         "hash_map",
         "hash_set",
         "heap",
         "interval_tree",
         "linked_list",
         "matrix",
         "mgraph",
         "pair",
         "queue",
         "red_black_tree",
         "scapegoat_tree",
         "skip_list",
         "sort",
         "splay_tree",
         "stack",
         "treap_tree",
         "tree_algorithms",
         "tree",
         "trie_tree",
         "vector"]

EXEC = "./temelia_performance "

# no. of failed and passed tests
failed = 0
passed = 0

print "* Compiling performance tests..."
subprocess.call("make")

print "* Testing Temelia's performance..."

for test in teste:
    if (subprocess.call(EXEC + test, shell=True) != 0):
        failed += 1 
    else:
        passed += 1 
    
print "Done."
print 'Statistics: ' + str(failed) + ' failed tests' + ' | ' + \
str(passed) + ' passed tests.'

